package cate.game.power;

import cate.game.GameBody;
import cate.game.attr.FightAttr;
import cate.game.attr.PowerAttrPart;
import cate.game.play.part.PlaySide;
import cate.game.role.Role;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.HashMap;
import java.util.Map;

@NoteClass("阵法培养")
public class PositionDevPowerFactor extends PowerAttrPart {


	@NoteField(value = "阵位属性",detail = "")
	private Map<Byte,FightAttr> posAttrMap = new HashMap<>();


	public PositionDevPowerFactor(GameBody game,PlaySide playSide){

	}

	public PositionDevPowerFactor(Role role, PlaySide playSide) {
		if (role == null || playSide == null || playSide.positionTid == 0) {
			return;
		}
		posAttrMap.putAll(role.getRes().formations.getPosAttrs(playSide.positionTid));
	}

	public PowerAttrPart buildHeroPart(byte pos) {
		PowerAttrPart part = new PowerAttrPart();
		part.merge(this);
		if (posAttrMap.containsKey(pos)) {
			part.attr.add(posAttrMap.get(pos));
		}
		return part;
	}
}
